package sk.sodik.atomFilter.feeds;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;

@Entity
public class FeedFilter {
	@Id
	/** 
	 * key should contains userId and name to by unique.
	 * 
	 *  @see FeedFilterId for the implementation of the key.
	 */
	private String key;

	public String name;

	public String userId;

	public String url;

	public String filter;
	
	public void setKey(String name, String userId)
	{
		FeedFilterId id = new FeedFilterId();
		id.name = name;
		id.userId = userId;
		this.key = id.toString();
		
		this.userId = userId;
		this.name = name;
	}
	
	public String getKey()
	{
		return key;
	}

	@Override
	public String toString() {
		return "Feed " + name + "/" + userId + "{" + url + " : " + filter + "}";
	}

}
